package StudySocket;
import java.io.*;
import java.net.Socket;
public class Client {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 10000);
        OutputStream netOut = socket.getOutputStream();//输出
        InputStream netIn = socket.getInputStream();//输入
        PrintWriter netOutPw = new PrintWriter(netOut);
        BufferedReader consleBr = new BufferedReader(new InputStreamReader(System.in));//使用控制台标准输入流
        BufferedReader netInBr = new BufferedReader(new InputStreamReader(netIn));
        while (true) {
            String str = consleBr.readLine();
            netOutPw.println(str);
            netOutPw.flush();
            if (str.equals("exit")) break;
            str = netInBr.readLine();
            System.out.println(str);
            if(str.equals("exit"))break;
        }
        netOut.close();
        netIn.close();
        socket.close();

    }
}
